#include <iostream>

using namespace std;

#define BEGINS(x) namespace x {
#define ENDS(x) }

BEGINS(test1)

int main() {
    const int constant = 10;
//    int *modifier = &constant;
//    int &modifier = constant;
    int *modifier = const_cast<int *>(&constant);
    *modifier = 11;
    cout << constant << endl;
    cout << *modifier << endl;
    int &reference = const_cast<int &>(constant);
    reference = 12;
    cout << constant << endl;
    cout << reference << endl;

    return 0;
}

ENDS(test1)

BEGINS(test2)

int main() {
    const int constant = 21;
    const int* const_p = &constant;
    int* modifier = (int*)(const_p);
    *modifier = 22;
    cout << constant << endl;
    cout << *modifier << endl;
    return 0;
}

ENDS(test2)

BEGINS(test3)

int main() {
    int variable = 21;
    int* const_p = &variable;
    int* modifier = const_cast<int*>(const_p);

    *modifier = 7;
    cout << "variable:" << variable << endl;

    return 0;
}

ENDS(test3)

int main() {
//    test1::main();
//    test2::main();
    test3::main();

    return 0;
}